﻿@model PagingDataSet<ImpeachReport>
@{
    Layout = null;

}
@if (Model.Count() > 0)
{
    <table class="table tn-va-middle">
        <thead>
            <tr>
                <th><input type="checkbox" value="0" id="selectAll" /></th>
                <th>被举报内容标题</th>
                <th>举报原因</th>
                <th>附加说明</th>
                <th>举报人</th>
                <th>举报时间</th>
            </tr>
        </thead>
        <tbody>
            @foreach (var impeachReport in Model)
                {
                <tr id="impeachReport-@impeachReport.Id">
                    <td>
                        <input name="checks" class="userCheckBox tn-checkbox" type="checkbox" data-id="@impeachReport.Id" />
                    </td>
                    <td>
                        <a target="_blank"  href="@(impeachReport.ImpeachObject?.DetailUrl)" title="@impeachReport.Title">
                        @if (
                            string.IsNullOrEmpty(impeachReport.Title))
                        {
                           <text>[图片]</text>
                        }
                        else
                        {
                            var index = impeachReport.Title.IndexOf('<');
                            if (index>-1)
                            {
                                var msg = impeachReport.Title.Substring(impeachReport.Title.IndexOf('<'), impeachReport.Title.Length - 4);
                                impeachReport.Title = impeachReport.Title.Replace(msg, "[表情]");
                            }


                            <text>@StringUtility.Trim(impeachReport.Title, 13)</text>
                        }
                       </a>
                        @if (!impeachReport.Status)
                        {
                            <span class="label label-danger">未处理</span>
                        }
                    </td>
                    <td>
                        @impeachReport.Reason.GetDisplayName()
                    </td>
                    <td>
                        @impeachReport.Description
                    </td>
                    <td>
                        @impeachReport.Reporter
                    </td>
                    <td>
                        @impeachReport.DateCreated.ToString("yyyy-MM-dd HH:mm")
                    </td>
                </tr>
            }
        </tbody>
    </table>
}
else
{
    <div class="text-center clearfix text-warning">无查询用户</div>
}
<input id="ListImpeachReportPageIndex" type="hidden" value="@Model.PageIndex">
<div class="text-center">
    @Html.AjaxPagingButton(Model, "_ListImpeachReports", CachedUrlHelper.Action("_ListImpeachReport", "ControlPanel",null,new RouteValueDictionary { { "isDisposed",ViewData.Get<bool?>("isDisposed", null) } }))
</div>


<script>
    require(['jquery'], function ($) {
        $("#selectAll").click( function () {
                if (this.checked == true) {
                    $(".tn-checkbox").each(function () {
                        this.checked = true;
                        $.fn.checkedActive($(this));
                    });
                    $.fn.checkedActive($(this));
                } else {
                    $(".tn-checkbox").each(function () 
                    {
                        this.checked = false;
                        $.fn.checkedActive($(this));
                    });
                    $.fn.checkedActive($(this));
                }
});
           })
</script>